package com.aiden.rxjavatest.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.aiden.rxjavatest.DaggerUserComponent;
import com.aiden.rxjavatest.R;
import com.aiden.rxjavatest.UserComponent;
import com.aiden.rxjavatest.annotation.Sign;
import com.aiden.rxjavatest.UserModule;
import com.aiden.rxjavatest.bean.User;

import javax.inject.Inject;

public class UserActivity extends AppCompatActivity {

    @Sign("stephen")
    @Inject
    User user;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user);
        TextView tvName = findViewById(R.id.tv_name);
//        DaggerUserComponent.builder().build().inject(this);
        UserComponent userComponent = DaggerUserComponent.builder().userModule(new UserModule()).build();

        userComponent.inject(this);
        tvName.setText(user.getName());
        userComponent.inject(this);
    }
}
